﻿using Cysharp.Threading.Tasks;
using System;
using System.Collections;
using UnityEngine;
using YooSceneHandle = YooAsset.SceneHandle;

namespace MFramework
{
    public class SceneHandle
    {
        private YooSceneHandle handle;

        public event Action<SceneHandle> Completed;
        public float Progress
        {
            get => handle.Progress;
        }

        public void OnRelease() { }

        public void Init(YooSceneHandle handle)
        {
            this.handle = handle;
            this.handle.Completed += (YooSceneHandle _handle) =>
            {
                this.Completed?.Invoke(this);
            };
        }
    }
}